﻿/*
	Copyright (C) 2019 Zongming Liu <1849059316@qq.com>

	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.
	
	You should have received a copy of the GNU General Public License along
	with this program; if not, write to the Free Software Foundation, Inc.,
	51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef IActableObject_h__
#define IActableObject_h__

#include "../base/Vector.h"
#include "../utility/SmartPtrDef.h"
#include "../base/GameWorld.h"
#include "../action/ActionManager.h"

#include <memory>

namespace SkyEngine2d
{
	
	/*!
	 \brief 可执行动作对象的接口
	 \details
	*/
	class IActableObject
	{
	public:
		virtual ~IActableObject()
		{
			GameWorld::getInstance()->getActionManger()->removeAllActionsOfTarget(this);
		}
	};
	
	
	/*!
	 \brief 可执行位移动作的接口
	 \details
	*/
	class IMovableObject
		:virtual public IActableObject
	{
	public:
		//! 获取对象当前的位置
		/*!
		\return Vector2
		*/
		virtual Vector2 getPosition()const = 0;
	
		//! 设置对象的位置
		/*!
		\param const Vector2& pos 位置
		\return void
		*/
		virtual void setPosition(const Vector2& pos) = 0;
	};
	
	/*!
	 \brief 可执行帧动画的接口
	 \details
	*/
	class IAnimatableObject
		:virtual  public IActableObject
	{
	public:
		//! 获取对象当前的精灵帧
		/*!
		\return SpriteFrameSharedPtr  
		*/
		virtual SpriteFrameSharedPtr getSpriteFrame()const = 0;
		
		//! 设置对象当前的精灵帧
		/*!
		\param const SpriteFrameSharedPtr & sprite_frame  精灵帧
		\return void  
		*/
		virtual void setSpriteFrame(const SpriteFrameSharedPtr& sprite_frame) = 0;
	};
}

#endif // IActableObject_h__
